from fastapi import APIRouter, Depends, Request

from app.core.responses import Response
from modules.admin.services.auth import get_current_user
from schemas.order_used import Create, Update
from modules.admin.services.order_used import OrderUsedService

router = APIRouter(prefix="/order_used", dependencies=[Depends(get_current_user)])


@router.get("/{order_id}", summary="记录状态")
async def index(current: int = 1, pageSize: int = 10):
    data = OrderUsedService.get_all(current, pageSize).serialize()
    return Response.success(data)


@router.post("", summary="创建记录")
async def store(form: Create):
    return OrderUsedService.create(form)
